<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"         
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:body>
<ui:composition template="/templates/templateNECS.xhtml">

            <ui:define name="top">
                Produtos
            </ui:define>

            <ui:define name="left">
                <h:outputLink value="admin_produto_criar.xhtml">Criar Produto</h:outputLink>
                <br /><br />       
                <h:outputLink value="admin_index.xhtml">voltar</h:outputLink>                                
            </ui:define>
        

       

           
        <ui:define name="content">
                <h:form>                    
                    <br/>

                    <h:dataTable
                        var="produto"
                        summary="Lista de todos os produtos"
                        value="#{administradorManager.produtos}"
                        rules="all"
                        cellpadding="5">
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Nome" />
                            </f:facet>
                            <h:outputText value="#{produto.nome}" />
                            <!--Falta validar o formato-->
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Preço" />
                            </f:facet>
                            <h:outputText value="#{produto.preco}" />
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Principio Ativo" />
                            </f:facet>
                            <h:outputText value="#{produto.principioAtivo}" />
                        </h:column>                        
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="laboratorio" />
                            </f:facet>
                            <h:outputText value="#{produto.laboratorio}" />
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Fornecedor" />
                            </f:facet>
                            <h:outputText value="#{produto.fornecedor}" />
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Fornecedor Alternativo" />
                            </f:facet>
                            <h:outputText value="#{produto.fornecedorAlternativo}" />
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Editar" />
                            </f:facet>
                            <h:commandButton value="Editar" action="#{administradorManager.setProdutoActualByNome(produto.nome)}" />
                        </h:column>
                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Apagar" />
                            </f:facet>
                            <h:commandButton value="Apagar" action="add_prod" />
                        </h:column>
                        
                    </h:dataTable>
                </h:form>
                <h:messages errorStyle="color: red" />              
            </ui:define>
    </ui:composition>
    </h:body>
</html>